package com.kuanter.kuanterauto.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.kuanter.kuanterauto.R;
import com.kuanter.kuanterauto.baseui.ProApplication;
import com.umeng.analytics.MobclickAgent;

public class ActivateCardSuccessedActivity extends Activity {
	private TextView finishTv;
	private TextView card_number_tv;
	private TextView card_jifen_tv;
	private TextView card_endtime_tv;
	private Intent intent;

	public void onResume() {
	    super.onResume();
	    MobclickAgent.onResume(this);
	}
	public void onPause() {
	    super.onPause();
	    MobclickAgent.onPause(this);
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activate_card_successed);
		ProApplication.getInstance().getActivityList().add(this);
		
		intent = getIntent();
		finishTv = (TextView)this.findViewById(R.id.textView2);
		//卡号
		card_number_tv = (TextView)this.findViewById(R.id.card_number_tv);
		card_number_tv.setText(intent.getStringExtra("cardNumber"));
		//积分
		card_jifen_tv = (TextView)this.findViewById(R.id.card_jifen_tv);
		card_jifen_tv.setText(intent.getStringExtra("pointBalance"));
		//到期时间
		card_endtime_tv = (TextView) this.findViewById(R.id.card_endtime_tv);
		String str = intent.getStringExtra("expireTime");
		if("暂无".equals(str)){
			card_endtime_tv.setText("暂无");
		}else{
			int index = str.lastIndexOf("-") +3 ;
			card_endtime_tv.setText(str.substring(0, index));
		}
		finishTv.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				for(Activity activity : ProApplication.getInstance().getActivityList()){
					activity.finish();
				}
				 ProApplication.getInstance().getActivityList().clear();
			}
		});
	}
}
